
** CODE for replication of Can conservatism make women more vulnerable to violence?
** Authors:  Victor Araujo Malu Gatto
** Journal: Comparative Political Studies (CPS)

** BEFORE running this code, please see the "READ_ME_FIRST" file for general instructions. 
** All procedures and analysis were executed using a license of STATA 16 

*****************************************
*** Data for municipal-level analyses ***
*****************************************

*** Calling the data from the repository
clear
use "G:\My Drive\Araújo_Gatto_papers\mulheres_MUNIC\Policies to tackle Violence against Women\data\CPS_materials\munic_analysis.dta"

*** Installing required packages
ssc install estout, replace
ssc install blindschemes, replace
ssc install coefplot, replace

*** Eliminating duplicated cases before start the analysis

duplicates report Cod_Municipio_x
duplicates list Cod_Municipio_x
egen number = seq()

drop if number == 4
drop if number == 5
drop if number == 80
drop if number == 110
drop if number == 142
drop if number == 146
drop if number == 172
drop if number == 188
drop if number == 295
drop if number == 327
drop if number == 328
drop if number == 397
drop if number == 474
drop if number == 485
drop if number == 562
drop if number == 644
drop if number == 681
drop if number == 689
drop if number == 697
drop if number == 698
drop if number == 706
drop if number == 707
drop if number == 710
drop if number == 743
drop if number == 755
drop if number == 756
drop if number == 760
drop if number == 779
drop if number == 793
drop if number == 817
drop if number == 831
drop if number == 838
drop if number == 842
drop if number == 846
drop if number == 863
drop if number == 864
drop if number == 871
drop if number == 888
drop if number == 915
drop if number == 937
drop if number == 1028
drop if number == 1112
drop if number == 1219
drop if number == 1240
drop if number == 1416 
drop if number == 1545 
drop if number == 1613 
drop if number == 1641 
drop if number == 1727 
drop if number == 1742 
drop if number == 1781
drop if number == 1783 
drop if number == 1784 
drop if number == 1843 
drop if number == 1849 
drop if number == 1865
drop if number == 1965
drop if number == 1994
drop if number == 2057
drop if number == 2079
drop if number == 2080
drop if number == 2117
drop if number == 2325
drop if number == 2362
drop if number == 2391
drop if number == 2392
drop if number == 2418
drop if number == 2436
drop if number == 2468
drop if number == 2506
drop if number == 2507
drop if number == 2546
drop if number == 2614
drop if number == 2675
drop if number == 2676
drop if number == 2683
drop if number == 2790
drop if number == 2838
drop if number == 2932
drop if number == 2987
drop if number == 3021
drop if number == 3022
drop if number == 3102
drop if number == 3176
drop if number == 3243
drop if number == 3276
drop if number == 3301
drop if number == 3303
drop if number == 3359
drop if number == 3395
drop if number == 3563
drop if number == 3564
drop if number == 3589
drop if number == 3675
drop if number == 3964
drop if number == 3965
drop if number == 4023
drop if number == 4045
drop if number == 4073
drop if number == 4074
drop if number == 4115
drop if number == 4120
drop if number == 4175
drop if number == 4176
drop if number == 4208
drop if number == 4414
drop if number == 4463
drop if number == 4483
drop if number == 4496
drop if number == 4559
drop if number == 4758
drop if number == 4820
drop if number == 4901
drop if number == 4920
drop if number == 4978
drop if number == 5054
drop if number == 5196
drop if number == 5201
drop if number == 5246
drop if number == 5313
drop if number == 5327
drop if number == 5387
drop if number == 5396
drop if number == 5397
drop if number == 5413
drop if number == 5429
drop if number == 5479


*** Double checking for duplicated cases
duplicates tag Cod_Municipio_x, generate(dup_munic)


** Before running the models, please complete the following steps:
*Creating a log of mucipalities population to account for huge variation in the number of inhabitants in the Brazilian municipalities  
gen ln_pop =ln(popt)
*Rename the variable that refers to the code of municipalities
rename Cod_Municipio_x code_munic
*Grouping protestants and pentecostals in a single group
gen evang = prop_trad + prop_pent

*************************************************
*** Code for replication of TABLE 1 MAIN TEXT ***
*************************************************

 *# Municipal Council on Women's Rights (Conselho municipal de direitos da mulher)
  tab MPPM13
 *# Specialized Women's Service Center (Centro Especializado de Atendimento à Mulher)
  tab MPPM241 
 *# Women's Shelters (Casas-Abrigo (responsabilidade da gestão não é do município))
  tab MPPM242 
 *# Sexual Violence Care Services (Serviços especializados de atendimento à violência sexual)
  tab MPPM243 
 *# Women's Police Station (Delegacia Especializada de Atendimento às Mulheres
  tab MPPM244 
 *# Special Court for VAW (Juizado ou vara especial de violência doméstica e familiar contra a mulher)
  tab MPPM245 
 *# Specialized Gender Prosecutor's Office (Promotorias Especializadas/Núcleos de Gênero do Ministério Público)
  tab MPPM246 
 *# Special Center for Women's Rights' Protection (Public Attorney) (Defensorias da Mulher ou Núcleo Especial de Defesa dos Direitos da Mulher)
  tab MPPM247 
 *# Maria da Penha Police Patrol (Patrulha Maria da Penha)
  tab MPPM249 
 *# Aggressor Accountability Service (Serviço de responsabilização do agressor)
  tab MPPM2410
  

*** Frequency distribution of policy instruments ***
** Protection policies  
  tab protection_all
** Justice policies
  tab justice_all



*****************************************************************
*** Code for replication of TABLE 1 MAIN TEXT (OLS estimates) ***
*****************************************************************

eststo clear
**All policies (with sociodemographic controls)
eststo:reg sum_all ideo_na_2016 whr_average prop_mulher prop_urb evang ln_pop idhm, cluster(code_munic)
**All policies (with sociodemographic controls + Municipal capacity indicadors)
eststo:reg sum_all ideo_na_2016 whr_average prop_mulher prop_urb evang ln_pop idhm high_educ_pc, cluster(code_munic)
**All policies (with sociodemographic controls + Electoral controls)
eststo:reg sum_all ideo_na_2016 whr_average prop_mulher prop_urb evang ln_pop idhm ///
      prop_woman mean_prop_rightpref mean_prop_mulher mean_prop_right mean_prop_pastor, cluster(code_munic)		
	  
** Protection policies (with sociodemographic controls)
eststo:reg protection_all  ideo_na_2016 whr_average prop_mulher prop_urb evang ln_pop idhm, cluster(code_munic)
** Protection policies (with sociodemographic controls + Municipal capacity indicadors)
eststo:reg protection_all  ideo_na_2016 whr_average prop_mulher prop_urb evang ln_pop idhm high_educ_pc, cluster(code_munic)
** Protection policies (with sociodemographic controls + Electoral controls)
eststo:reg protection_all ideo_na_2016 whr_average prop_mulher prop_urb evang ln_pop idhm ///
        prop_woman mean_prop_rightpref mean_prop_mulher mean_prop_right mean_prop_pastor, cluster(code_munic)
				
**Justice policies (with sociodemographic controls)
eststo:reg justice_all ideo_na_2016 whr_average prop_mulher prop_urb evang ln_pop idhm, cluster(code_munic)
**Justice policies (with sociodemographic controls + Municipal capacity indicadors)
eststo:reg justice_all ideo_na_2016 whr_average prop_mulher prop_urb evang ln_pop idhm high_educ_pc, cluster(code_munic)
**Justice policies (with sociodemographic controls + Electoral controls)
eststo:reg justice_all ideo_na_2016 whr_average prop_mulher prop_urb evang ln_pop idhm ///
       prop_woman mean_prop_rightpref mean_prop_mulher mean_prop_right mean_prop_pastor, cluster(code_munic)	 
esttab using example.tex, label replace booktabs ///
alignment(D{.}{.}{-1})                         ///
star(* 0.10 ** 0.05 *** 0.01) se ///
stats(r2_a N N_clust, fmt(%9.3f %9.0g) labels("R^{2}" Observations "N.Clusters")) ///
collabels(none) varlabels(ideo_na_2016 "Electoral conservatism" whr_average "Femicide rate" prop_mulher "\% Women population" prop_urb "\% Urban population" ///
evang "\% Evangelical population" ln_pop "Population size (log)" idhm "HDI" high_educ_pc "Bureaucratic capacity" ///
prop_woman "\% Elected women (Mayor)" mean_prop_rightpref "\% Elected right-wing (Mayor)"  mean_prop_mulher "\% Elected women (Council)" mean_prop_right "\% Elected right-wing (Council)" ///
mean_prop_pastor "\% Elected evangelical (Council)" _cons "Constant") ///
title(The effect of constituencies' left-right ideology on the number of VAW policy instruments\label{vaw_munic})
eststo clear



*********************************************
*** Plotting effects - FIGURE 2 MAIN TEXT ***
*********************************************

set scheme plotplain
* All policies
reg sum_all ideo_na_2016 whr_average prop_mulher prop_urb evang idhm ln_pop prop_woman mean_prop_rightpref mean_prop_mulher mean_prop_right mean_prop_pastor, cluster(code_munic)
margins, at(ideo_na_2016=(-.351(.1).6355)) post
estimates store m_1 
coefplot m_1, title("(A) All policies") ytitle(Number of policy instruments) xtitle(Electoral conservativism) ///
    at recast(line) lwidth(*2) ciopts(recast(rline) lpattern(dash))  levels(90)
	
	
* Protection policies
reg protection_all ideo_na_2016 whr_average prop_mulher prop_urb evang idhm ln_pop prop_woman mean_prop_rightpref mean_prop_mulher mean_prop_right mean_prop_pastor, cluster(code_munic)
margins, at(ideo_na_2016=(-.351(.1).6355)) post
estimates store m_3
coefplot m_3, title("(B) Protection policies") ytitle(Number of policy instruments) xtitle(Electoral conservativism) ///
    at recast(line) lwidth(*2) ciopts(recast(rline) lpattern(dash))	levels(90)	 

		
* Justice policies
reg justice_all ideo_na_2016 whr_average prop_mulher prop_urb evang idhm ln_pop prop_woman mean_prop_rightpref mean_prop_mulher mean_prop_right mean_prop_pastor, cluster(code_munic)
margins, at(ideo_na_2016=(-.351(.1).6355)) post
estimates store m_2
coefplot m_2, title("(C) Justice policies") ytitle(Number of policy instruments) xtitle(Electoral conservativism) ///
    at recast(line) lwidth(*2) ciopts(recast(rline) lpattern(dash))	levels(90)	
	

* Histogram of electoral conservatism
set scheme plotplain
hist ideo_na_2016, freq 	
	

* Combining the figures created above (do not forget to update your directory before running the lines below)
* The figures created above must be in the chosen directory		
	
cd "G:\My Drive\Araújo_Gatto_papers\mulheres_MUNIC\Policies to tackle Violence against Women\data\CPS_figures"
		
graph combine figure1.gph figure2.gph figure3.gph, ///
name("firstset", replace) ycommon cols(3) title("")
graph combine hist_conservatism.gph, ///
name("secondset", replace) ycommon cols(1) title("")
graph combine firstset secondset, ///
saving("sevenpanelgraph.gph", replace) ycommon cols(1) iscale(1.05)	
*graph export sevenpanelgraph.eps, replace



************************************************
** Descriptive Statistics - TABLE 1 APPENDIX ***
************************************************

su sum_all justice_all protection_all any_policy any_justice any_protection MTIP05 MTIP09 MTIP11 MTIP13 MTIP07 ///
   ideo_na_2016 whr_average prop_mulher prop_urb evang ln_pop idhm  ///
   prop_woman mean_prop_rightpref mean_prop_mulher mean_prop_right mean_prop_pastor
   

*************************************************************
*** Baseline models (without controls) - TABLE 2 APPENDIX ***
*************************************************************

eststo clear
** All policies (with sociodemographic controls)
eststo:reg sum_all ideo_na_2016, cluster(code_munic)
** Protection policies (with sociodemographic controls)
eststo:reg protection_all ideo_na_2016, cluster(code_munic)
** Justice policies (with sociodemographic controls)
eststo:reg justice_all ideo_na_2016, cluster(code_munic)
esttab using example.tex, label replace booktabs ///
alignment(D{.}{.}{-1})                         ///
star(* 0.10 ** 0.05 *** 0.01) se ///
stats(r2_a N N_clust, fmt(%9.3f %9.0g) labels("R^{2}" "Observations" "N.Clusters")) ///
collabels(none) varlabels(ideo_na_2016 "Electoral conservatism" _cons "Constant") ///
title(The effect of constituencies' left-right ideology on the number of VAW policy instruments\label{vaw_munic_base})
eststo clear

	
***********************************************************************************************
*** Municipal analysis: Other outcome variables (different policy areas) - TABLE 3 APPENDIX ***
***********************************************************************************************

eststo clear	

** O MUNIC tem programas ou projetos de qualificação profissional e intermediação de mão de obra?
** Employment
eststo: logit MTIP07 ideo_na_2016 whr_average prop_mulher prop_urb evang ln_pop idhm ///
      prop_woman mean_prop_rightpref mean_prop_mulher mean_prop_right mean_prop_pastor, cluster(code_munic)	
** O MUNIC tem programas ou projetos de geração de trabalho e renda?
** Income policies	  	  
eststo: logit MTIP13 ideo_na_2016 whr_average prop_mulher prop_urb evang ln_pop idhm ///
      prop_woman mean_prop_rightpref mean_prop_mulher mean_prop_right mean_prop_pastor, cluster(code_munic)		  		  
** O MUNIC tem programas ou projetos de crédito, microcrédito e seguro?	
** credit policies
eststo: logit MTIP11 ideo_na_2016 whr_average prop_mulher prop_urb evang ln_pop idhm ///
      prop_woman mean_prop_rightpref mean_prop_mulher mean_prop_right mean_prop_pastor, cluster(code_munic)		  	  
** O MUNIC tem programas ou projetos de inclusão produtiva urbana?
** Urban develop.  	 
eststo: logit MTIP09 ideo_na_2016 whr_average prop_mulher prop_urb evang ln_pop idhm ///
      prop_woman mean_prop_rightpref mean_prop_mulher mean_prop_right mean_prop_pastor, cluster(code_munic)		 		 
** O MUNIC tem  programas ou projetos de inclusão produtiva rural?
** Rural develop.	  	  
eststo: logit MTIP05 ideo_na_2016 whr_average prop_mulher prop_urb evang ln_pop idhm ///
      prop_woman mean_prop_rightpref mean_prop_mulher mean_prop_right mean_prop_pastor, cluster(code_munic)		  		
esttab using example.tex, label replace booktabs ///
alignment(D{.}{.}{-1})                         ///
star(* 0.10 ** 0.05 *** 0.01) se ///
stats(r2_p chi2 N N_clust, fmt(%9.3f %9.0g) labels("Pseudo R^{2}" "Wald chi2" "Observations" "N.Clusters")) ///
collabels(none) varlabels(ideo_na_2016 "Electoral conservatism" whr_average "Femicide rate" prop_mulher "\% Women population" prop_urb "\% Urban population" ///
evang "\% Evangelical population" ln_pop "Population size (log)" idhm "HDI" high_educ_pc "Bureaucratic capacity" ///
prop_woman "\% Elected women (Mayor)" mean_prop_rightpref "\% Elected right-wing (Mayor)"  mean_prop_mulher "\% Elected women (Council)" mean_prop_right "\% Elected right-wing (Council)" ///
mean_prop_pastor "\% Elected evangelical (Council)" _cons "Constant") ///
title(The effect of constituencies' left-right ideology on the number of VAW policy instruments\label{other_munic})
eststo clear


   
   

   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
	
	
	
	
	





